#include "widget.h"
#include "ui_widget.h"
#include <QPainter>
#include <QLabel>
#include "dij.h"
#include <QColor>
#include <QPen>
#include <QPixmap>
#include <QThread>
#include <QTimer>
#include <QVector>
#include <QDateTime>
#include <QMutex>


#define WIN_WIGHT   1500
#define WIN_HEIGHT  1000
double k;
double b;
double star_x;
double end_x;
bool falt;
int count2=1;
int count22=1;
int count3=1;
Map map;

Widget::Widget(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::Widget)
{
    ui->setupUi(this);
    t1=new QTimer(this);
    connect(t1,SIGNAL(timeout()),this,SLOT(timerUpDate()));
    t1->start(1000);
    Pix=QPixmap(WIN_WIGHT,WIN_HEIGHT);
    Pix.fill(Qt::white);
    ui->item->setText("中国高速路局部图");
    ui->m_pb1->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
					"QPushButton:hover{background-color: rgb(20, 62, 190);}"
					"QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb2->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
					"QPushButton:hover{background-color: rgb(20, 62, 190);}"
					"QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb3->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
					"QPushButton:hover{background-color: rgb(20, 62, 190);}"
					"QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb4->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                     "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                     "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb5->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb6->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb7->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb8->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb9->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb10->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb11->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb12->setStyleSheet("QPushButton{background-color: rgb(124, 252, 0);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb13->setStyleSheet("QPushButton{background-color: rgb(205,117, 0);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb14->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb15->setStyleSheet("QPushButton{background-color: rgb(0,197, 205);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb16->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb17->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb18->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb19->setStyleSheet("QPushButton{background-color: rgb(0,197, 205);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb20->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb21->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb22->setStyleSheet("QPushButton{background-color: rgb(60, 150, 40);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->m_pb23->setStyleSheet("QPushButton{background-color: rgb(205,117, 0);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");


    QLabel* lb1=new QLabel(this);
    lb1->setStyleSheet("color:blue");
    lb1->setText(getDex(ui->m_pb1,ui->m_pb2));
    lb1->move(ui->m_pb1->pos().x()+(ui->m_pb2->pos().x()-ui->m_pb1->pos().x())/2+1,ui->m_pb1->pos().y()+(ui->m_pb2->pos().y()-ui->m_pb1->pos().y())/2+1);

    QLabel* lb2=new QLabel(this);
    lb2->setStyleSheet("color:blue");
    lb2->setText(getDex(ui->m_pb2,ui->m_pb3));
    lb2->move(ui->m_pb2->pos().x()+(ui->m_pb3->pos().x()-ui->m_pb2->pos().x())/2+1,ui->m_pb2->pos().y()+(ui->m_pb3->pos().y()-ui->m_pb2->pos().y())/2+1);

    QLabel* lb3=new QLabel(this);
    lb3->setStyleSheet("color:blue");
    lb3->setText(getDex(ui->m_pb3,ui->m_pb1));
    lb3->move(ui->m_pb3->pos().x()+(ui->m_pb1->pos().x()-ui->m_pb3->pos().x())/2+1,ui->m_pb3->pos().y()+(ui->m_pb1->pos().y()-ui->m_pb3->pos().y())/2+1);

    QLabel* lb4=new QLabel(this);
    lb4->setStyleSheet("color:blue");
    lb4->setText(getDex(ui->m_pb1,ui->m_pb4));
    lb4->move(ui->m_pb1->pos().x()+(ui->m_pb4->pos().x()-ui->m_pb1->pos().x())/2+1,ui->m_pb1->pos().y()+(ui->m_pb4->pos().y()-ui->m_pb1->pos().y())/2+2);

    QLabel* lb5=new QLabel(this);
    lb5->setStyleSheet("color:blue");
    lb5->setText(getDex(ui->m_pb4,ui->m_pb9));
    lb5->move(ui->m_pb4->pos().x()+(ui->m_pb9->pos().x()-ui->m_pb4->pos().x())/2+1,ui->m_pb4->pos().y()+(ui->m_pb9->pos().y()-ui->m_pb4->pos().y())/2+1);

    QLabel* lb6=new QLabel(this);
    lb6->setStyleSheet("color:blue");
    lb6->setText(getDex(ui->m_pb9,ui->m_pb7));
    lb6->move(ui->m_pb9->pos().x()+(ui->m_pb7->pos().x()-ui->m_pb9->pos().x())/2+1,ui->m_pb9->pos().y()+(ui->m_pb7->pos().y()-ui->m_pb9->pos().y())/2+1);

    QLabel* lb7=new QLabel(this);
    lb7->setStyleSheet("color:blue");
    lb7->setText(getDex(ui->m_pb3,ui->m_pb9));
    lb7->move(ui->m_pb3->pos().x()+(ui->m_pb9->pos().x()-ui->m_pb3->pos().x())/2+1,ui->m_pb3->pos().y()+(ui->m_pb9->pos().y()-ui->m_pb3->pos().y())/2+1);

    QLabel* lb8=new QLabel(this);
    lb8->setStyleSheet("color:blue");
    lb8->setText(getDex(ui->m_pb3,ui->m_pb5));
    lb8->move(ui->m_pb3->pos().x()+(ui->m_pb5->pos().x()-ui->m_pb3->pos().x())/2+1,ui->m_pb3->pos().y()+(ui->m_pb5->pos().y()-ui->m_pb3->pos().y())/2+1);

    QLabel* lb9=new QLabel(this);
    lb9->setStyleSheet("color:blue");
    lb9->setText(getDex(ui->m_pb5,ui->m_pb7));
    lb9->move(ui->m_pb5->pos().x()+(ui->m_pb7->pos().x()-ui->m_pb5->pos().x())/2+1,ui->m_pb5->pos().y()+(ui->m_pb7->pos().y()-ui->m_pb5->pos().y())/2+1);

    QLabel* lb10=new QLabel(this);
    lb10->setStyleSheet("color:blue");
    lb10->setText(getDex(ui->m_pb7,ui->m_pb10));
    lb10->move(ui->m_pb7->pos().x()+(ui->m_pb10->pos().x()-ui->m_pb7->pos().x())/2+1,ui->m_pb7->pos().y()+(ui->m_pb10->pos().y()-ui->m_pb7->pos().y())/2+1);

    QLabel* lb11=new QLabel(this);
    lb11->setStyleSheet("color:blue");
    lb11->setText(getDex(ui->m_pb6,ui->m_pb10));
    lb11->move(ui->m_pb6->pos().x()+(ui->m_pb10->pos().x()-ui->m_pb6->pos().x())/2+1,ui->m_pb6->pos().y()+(ui->m_pb10->pos().y()-ui->m_pb6->pos().y())/2+1);

    QLabel* lb12=new QLabel(this);
    lb12->setStyleSheet("color:blue");
    lb12->setText(getDex(ui->m_pb5,ui->m_pb6));
    lb12->move(ui->m_pb5->pos().x()+(ui->m_pb6->pos().x()-ui->m_pb5->pos().x())/2+1,ui->m_pb5->pos().y()+(ui->m_pb6->pos().y()-ui->m_pb5->pos().y())/2+1);

    QLabel* lb13=new QLabel(this);
    lb13->setStyleSheet("color:blue");
    lb13->setText(getDex(ui->m_pb6,ui->m_pb8));
    lb13->move(ui->m_pb6->pos().x()+(ui->m_pb8->pos().x()-ui->m_pb6->pos().x())/2+1,ui->m_pb6->pos().y()+(ui->m_pb8->pos().y()-ui->m_pb6->pos().y())/2+1);

    QLabel* lb14=new QLabel(this);
    lb14->setStyleSheet("color:blue");
    lb14->setText(getDex(ui->m_pb2,ui->m_pb4));
    lb14->move(ui->m_pb2->pos().x()+(ui->m_pb4->pos().x()-ui->m_pb2->pos().x())/2+1,ui->m_pb2->pos().y()+(ui->m_pb4->pos().y()-ui->m_pb2->pos().y())/2+1);

    QLabel* lb15=new QLabel(this);
    lb15->setStyleSheet("color:blue");
    lb15->setText(getDex(ui->m_pb1,ui->m_pb9));
    lb15->move(ui->m_pb1->pos().x()+(ui->m_pb9->pos().x()-ui->m_pb1->pos().x())/2+1,ui->m_pb1->pos().y()+(ui->m_pb9->pos().y()-ui->m_pb1->pos().y())/2+1);

    QLabel* lb16=new QLabel(this);
    lb16->setStyleSheet("color:blue");
    lb16->setText(getDex(ui->m_pb2,ui->m_pb11));
    lb16->move(ui->m_pb2->pos().x()+(ui->m_pb11->pos().x()-ui->m_pb2->pos().x())/2+1,ui->m_pb2->pos().y()+(ui->m_pb11->pos().y()-ui->m_pb2->pos().y())/2+1);

    QLabel* lb17=new QLabel(this);
    lb17->setStyleSheet("color:blue");
    lb17->setText(getDex(ui->m_pb11,ui->m_pb4));
    lb17->move(ui->m_pb11->pos().x()+(ui->m_pb4->pos().x()-ui->m_pb11->pos().x())/2+1,ui->m_pb11->pos().y()+(ui->m_pb4->pos().y()-ui->m_pb11->pos().y())/2+1);

    QLabel* lb18=new QLabel(this);
    lb18->setStyleSheet("color:blue");
    lb18->setText(getDex(ui->m_pb4,ui->m_pb12));
    lb18->move(ui->m_pb4->pos().x()+(ui->m_pb12->pos().x()-ui->m_pb4->pos().x())/2+1,ui->m_pb4->pos().y()+(ui->m_pb12->pos().y()-ui->m_pb4->pos().y())/2+1);

    QLabel* lb19=new QLabel(this);
    lb19->setStyleSheet("color:blue");
    lb19->setText(getDex(ui->m_pb12,ui->m_pb14));
    lb19->move(ui->m_pb12->pos().x()+(ui->m_pb14->pos().x()-ui->m_pb12->pos().x())/2+1,ui->m_pb12->pos().y()+(ui->m_pb14->pos().y()-ui->m_pb12->pos().y())/2+1);

    QLabel* lb20=new QLabel(this);
    lb20->setStyleSheet("color:blue");
    lb20->setText(getDex(ui->m_pb14,ui->m_pb15));
    lb20->move(ui->m_pb15->pos().x()+(ui->m_pb14->pos().x()-ui->m_pb15->pos().x())/2+1,ui->m_pb14->pos().y()+(ui->m_pb15->pos().y()-ui->m_pb14->pos().y())/2+1);

    QLabel* lb21=new QLabel(this);
    lb21->setStyleSheet("color:blue");
    lb21->setText(getDex(ui->m_pb15,ui->m_pb16));
    lb21->move(ui->m_pb16->pos().x()+(ui->m_pb15->pos().x()-ui->m_pb16->pos().x())/2+1,ui->m_pb15->pos().y()+(ui->m_pb16->pos().y()-ui->m_pb15->pos().y())/2+1);

    QLabel* lb22=new QLabel(this);
    lb22->setStyleSheet("color:blue");
    lb22->setText(getDex(ui->m_pb10,ui->m_pb16));
    lb22->move(ui->m_pb10->pos().x()+(ui->m_pb16->pos().x()-ui->m_pb10->pos().x())/2+1,ui->m_pb16->pos().y()+(ui->m_pb10->pos().y()-ui->m_pb16->pos().y())/2+1);

    QLabel* lb23=new QLabel(this);
    lb23->setStyleSheet("color:blue");
    lb23->setText(getDex(ui->m_pb10,ui->m_pb17));
    lb23->move(ui->m_pb10->pos().x()+(ui->m_pb17->pos().x()-ui->m_pb10->pos().x())/2+1,ui->m_pb10->pos().y()+(ui->m_pb17->pos().y()-ui->m_pb10->pos().y())/2+1);

    QLabel* lb24=new QLabel(this);
    lb24->setStyleSheet("color:blue");
    lb24->setText(getDex(ui->m_pb17,ui->m_pb18));
    lb24->move(ui->m_pb18->pos().x()+(ui->m_pb17->pos().x()-ui->m_pb18->pos().x())/2+1,ui->m_pb18->pos().y()+(ui->m_pb17->pos().y()-ui->m_pb18->pos().y())/2+1);

    QLabel* lb25=new QLabel(this);
    lb25->setStyleSheet("color:blue");
    lb25->setText(getDex(ui->m_pb7,ui->m_pb13));
    lb25->move(ui->m_pb7->pos().x()+(ui->m_pb13->pos().x()-ui->m_pb7->pos().x())/2+1,ui->m_pb7->pos().y()+(ui->m_pb13->pos().y()-ui->m_pb7->pos().y())/2+1);

    QLabel* lb26=new QLabel(this);
    lb26->setStyleSheet("color:blue");
    lb26->setText(getDex(ui->m_pb13,ui->m_pb15));
    lb26->move(ui->m_pb13->pos().x()+(ui->m_pb15->pos().x()-ui->m_pb13->pos().x())/2+1,ui->m_pb13->pos().y()+(ui->m_pb15->pos().y()-ui->m_pb13->pos().y())/2+1);

    QLabel* lb27=new QLabel(this);
    lb27->setStyleSheet("color:blue");
    lb27->setText(getDex(ui->m_pb9,ui->m_pb13));
    lb27->move(ui->m_pb9->pos().x()+(ui->m_pb13->pos().x()-ui->m_pb9->pos().x())/2+1,ui->m_pb9->pos().y()+(ui->m_pb13->pos().y()-ui->m_pb9->pos().y())/2+1);

    QLabel* lb28=new QLabel(this);
    lb28->setStyleSheet("color:blue");
    lb28->setText(getDex(ui->m_pb8,ui->m_pb18));
    lb28->move(ui->m_pb8->pos().x()+(ui->m_pb18->pos().x()-ui->m_pb8->pos().x())/2+1,ui->m_pb8->pos().y()+(ui->m_pb18->pos().y()-ui->m_pb8->pos().y())/2+1);

    QLabel* lb29=new QLabel(this);
    lb29->setStyleSheet("color:blue");
    lb29->setText(getDex(ui->m_pb19,ui->m_pb18));
    lb29->move(ui->m_pb19->pos().x()+(ui->m_pb18->pos().x()-ui->m_pb19->pos().x())/2+1,ui->m_pb18->pos().y()+(ui->m_pb19->pos().y()-ui->m_pb18->pos().y())/2+1);

    QLabel* lb30=new QLabel(this);
    lb30->setStyleSheet("color:blue");
    lb30->setText(getDex(ui->m_pb19,ui->m_pb8));
    lb30->move(ui->m_pb19->pos().x()+(ui->m_pb8->pos().x()-ui->m_pb19->pos().x())/2+1,ui->m_pb8->pos().y()+(ui->m_pb19->pos().y()-ui->m_pb8->pos().y())/2+1);

    QLabel* lb31=new QLabel(this);
    lb31->setStyleSheet("color:blue");
    lb31->setText(getDex(ui->m_pb5,ui->m_pb19));
    lb31->move(ui->m_pb5->pos().x()+(ui->m_pb19->pos().x()-ui->m_pb5->pos().x())/2+1,ui->m_pb5->pos().y()+(ui->m_pb19->pos().y()-ui->m_pb5->pos().y())/2+1);

    QLabel* lb32=new QLabel(this);
    lb32->setStyleSheet("color:blue");
    lb32->setText(getDex(ui->m_pb20,ui->m_pb19));
    lb32->move(ui->m_pb20->pos().x()+(ui->m_pb19->pos().x()-ui->m_pb20->pos().x())/2+1,ui->m_pb20->pos().y()+(ui->m_pb19->pos().y()-ui->m_pb20->pos().y())/2+1);

    QLabel* lb33=new QLabel(this);
    lb33->setStyleSheet("color:blue");
    lb33->setText(getDex(ui->m_pb20,ui->m_pb5));
    lb33->move(ui->m_pb20->pos().x()+(ui->m_pb5->pos().x()-ui->m_pb20->pos().x())/2+1,ui->m_pb5->pos().y()+(ui->m_pb20->pos().y()-ui->m_pb5->pos().y())/2+1);

    QLabel* lb34=new QLabel(this);
    lb34->setStyleSheet("color:blue");
    lb34->setText(getDex(ui->m_pb21,ui->m_pb20));
    lb34->move(ui->m_pb21->pos().x()+(ui->m_pb20->pos().x()-ui->m_pb21->pos().x())/2+1,ui->m_pb21->pos().y()+(ui->m_pb20->pos().y()-ui->m_pb21->pos().y())/2+1);

    QLabel* lb35=new QLabel(this);
    lb35->setStyleSheet("color:blue");
    lb35->setText(getDex(ui->m_pb21,ui->m_pb22));
    lb35->move(ui->m_pb22->pos().x()+(ui->m_pb21->pos().x()-ui->m_pb22->pos().x())/2+1,ui->m_pb22->pos().y()+(ui->m_pb21->pos().y()-ui->m_pb22->pos().y())/2+1);

    QLabel* lb36=new QLabel(this);
    lb36->setStyleSheet("color:blue");
    lb36->setText(getDex(ui->m_pb22,ui->m_pb23));
    lb36->move(ui->m_pb22->pos().x()+(ui->m_pb23->pos().x()-ui->m_pb22->pos().x())/2+1,ui->m_pb23->pos().y()+(ui->m_pb22->pos().y()-ui->m_pb23->pos().y())/2+1);

    QLabel* lb37=new QLabel(this);
    lb37->setStyleSheet("color:blue");
    lb37->setText(getDex(ui->m_pb22,ui->m_pb2));
    lb37->move(ui->m_pb22->pos().x()+(ui->m_pb2->pos().x()-ui->m_pb22->pos().x())/2+1,ui->m_pb2->pos().y()+(ui->m_pb22->pos().y()-ui->m_pb2->pos().y())/2+1);

    QLabel* lb38=new QLabel(this);
    lb38->setStyleSheet("color:blue");
    lb38->setText(getDex(ui->m_pb21,ui->m_pb5));
    lb38->move(ui->m_pb21->pos().x()+(ui->m_pb5->pos().x()-ui->m_pb21->pos().x())/2+1,ui->m_pb21->pos().y()+(ui->m_pb5->pos().y()-ui->m_pb21->pos().y())/2+1);

    QLabel* lb39=new QLabel(this);
    lb39->setStyleSheet("color:blue");
    lb39->setText(getDex(ui->m_pb2,ui->m_pb23));
    lb39->move(ui->m_pb2->pos().x()+(ui->m_pb23->pos().x()-ui->m_pb2->pos().x())/2+1,ui->m_pb2->pos().y()+(ui->m_pb23->pos().y()-ui->m_pb2->pos().y())/2+1);

    QLabel* lb40=new QLabel(this);
    lb40->setStyleSheet("color:blue");
    lb40->setText(getDex(ui->m_pb23,ui->m_pb3));
    lb40->move(ui->m_pb23->pos().x()+(ui->m_pb3->pos().x()-ui->m_pb23->pos().x())/2+1,ui->m_pb23->pos().y()+(ui->m_pb3->pos().y()-ui->m_pb23->pos().y())/2+1);

    QLabel* lb41=new QLabel(this);
    lb41->setStyleSheet("color:blue");
    lb41->setText(getDex(ui->m_pb9,ui->m_pb12));
    lb41->move(ui->m_pb9->pos().x()+(ui->m_pb12->pos().x()-ui->m_pb9->pos().x())/2+1,ui->m_pb12->pos().y()+(ui->m_pb9->pos().y()-ui->m_pb12->pos().y())/2+1);

    ui->m_pb1->setEnabled(true);
    ui->m_pb2->setEnabled(true);
    ui->m_pb3->setEnabled(true);
}

Widget::~Widget()
{
	delete ui;
}

QString Widget::getDex(QPushButton* q1, QPushButton* q2){
   double x1,x2,y1,y2;
   x1=q1->x(); y1=q1->y();
   x2=q2->x(); y2=q2->y();
   return QString::number(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)),10,1);
}

void Widget::timerUpDate(){
    QDateTime time=QDateTime::currentDateTime();
    QString str = time.toString("yyyy-MM-dd hh:mm:ss dddd");
    ui->label_time->setText(str);
}

void Widget::paintEvent(QPaintEvent *)
{
	QPainter paint(this);
    paint.drawPixmap(0,0,WIN_WIGHT,WIN_HEIGHT,Pix);
    QColor balck(0,0,0);
    QPen pen(balck);
    pen.setWidth(2);
    paint.setPen(pen);
    QPoint point1(ui->m_pb1->pos().x()+ui->m_pb1->width()/2,ui->m_pb1->pos().y()+ui->m_pb1->height()/2);
    QPoint point2(ui->m_pb2->pos().x()+ui->m_pb2->width()/2,ui->m_pb2->pos().y()+ui->m_pb2->height()/2);
    QPoint point3(ui->m_pb3->pos().x()+ui->m_pb3->width()/2,ui->m_pb3->pos().y()+ui->m_pb3->height()/2);
    QPoint point4(ui->m_pb4->pos().x()+ui->m_pb4->width()/2,ui->m_pb4->pos().y()+ui->m_pb4->height()/2);
    QPoint point5(ui->m_pb5->pos().x()+ui->m_pb5->width()/2,ui->m_pb5->pos().y()+ui->m_pb5->height()/2);
    QPoint point6(ui->m_pb6->pos().x()+ui->m_pb6->width()/2,ui->m_pb6->pos().y()+ui->m_pb6->height()/2);
    QPoint point7(ui->m_pb7->pos().x()+ui->m_pb7->width()/2,ui->m_pb7->pos().y()+ui->m_pb7->height()/2);
    QPoint point8(ui->m_pb8->pos().x()+ui->m_pb8->width()/2,ui->m_pb8->pos().y()+ui->m_pb8->height()/2);
    QPoint point9(ui->m_pb9->pos().x()+ui->m_pb9->width()/2,ui->m_pb9->pos().y()+ui->m_pb9->height()/2);
    QPoint point10(ui->m_pb10->pos().x()+ui->m_pb10->width()/2,ui->m_pb10->pos().y()+ui->m_pb10->height()/2);
    QPoint point11(ui->m_pb11->pos().x()+ui->m_pb11->width()/2,ui->m_pb11->pos().y()+ui->m_pb11->height()/2);
    QPoint point12(ui->m_pb12->pos().x()+ui->m_pb12->width()/2,ui->m_pb12->pos().y()+ui->m_pb12->height()/2);
    QPoint point13(ui->m_pb13->pos().x()+ui->m_pb13->width()/2,ui->m_pb13->pos().y()+ui->m_pb13->height()/2);
    QPoint point14(ui->m_pb14->pos().x()+ui->m_pb14->width()/2,ui->m_pb14->pos().y()+ui->m_pb14->height()/2);
    QPoint point15(ui->m_pb15->pos().x()+ui->m_pb15->width()/2,ui->m_pb15->pos().y()+ui->m_pb15->height()/2);
    QPoint point16(ui->m_pb16->pos().x()+ui->m_pb16->width()/2,ui->m_pb16->pos().y()+ui->m_pb16->height()/2);
    QPoint point17(ui->m_pb17->pos().x()+ui->m_pb17->width()/2,ui->m_pb17->pos().y()+ui->m_pb17->height()/2);
    QPoint point18(ui->m_pb18->pos().x()+ui->m_pb18->width()/2,ui->m_pb18->pos().y()+ui->m_pb18->height()/2);
    QPoint point19(ui->m_pb19->pos().x()+ui->m_pb19->width()/2,ui->m_pb19->pos().y()+ui->m_pb19->height()/2);
    QPoint point20(ui->m_pb20->pos().x()+ui->m_pb20->width()/2,ui->m_pb20->pos().y()+ui->m_pb20->height()/2);
    QPoint point21(ui->m_pb21->pos().x()+ui->m_pb21->width()/2,ui->m_pb21->pos().y()+ui->m_pb21->height()/2);
    QPoint point22(ui->m_pb22->pos().x()+ui->m_pb22->width()/2,ui->m_pb22->pos().y()+ui->m_pb22->height()/2);
    QPoint point23(ui->m_pb23->pos().x()+ui->m_pb23->width()/2,ui->m_pb23->pos().y()+ui->m_pb23->height()/2);

    points.clear();
    points.append(point1); //0
    points.append(point2); //1
    points.append(point3); //2
    points.append(point4); //3
    points.append(point5);  //4
    points.append(point6);  //5
    points.append(point7);  //6
    points.append(point8);  //7
    points.append(point9);
    points.append(point10);
    points.append(point11);
    points.append(point12);
    points.append(point13);
    points.append(point14);
    points.append(point15);
    points.append(point16);
    points.append(point17);
    points.append(point18);
    points.append(point19);
    points.append(point20);
    points.append(point21);
    points.append(point22);
    points.append(point23);


    paint.drawLine(point1,point2);
    paint.drawLine(point2,point3);
    paint.drawLine(point2,point4);
    paint.drawLine(point5,point3);
    paint.drawLine(point1,point3);
    paint.drawLine(point1,point4);
    paint.drawLine(point1,point9);
    paint.drawLine(point4,point9);
    paint.drawLine(point3,point9);
    paint.drawLine(point9,point7);
    paint.drawLine(point7,point10);
    paint.drawLine(point6,point10);
    paint.drawLine(point6,point8);
    paint.drawLine(point5,point6);
    paint.drawLine(point5,point7);
    paint.drawLine(point2,point11);
    paint.drawLine(point11,point4);
    paint.drawLine(point4,point12);
    paint.drawLine(point12,point9);
    paint.drawLine(point9,point13);
    paint.drawLine(point13,point7);
    paint.drawLine(point13,point15);
    paint.drawLine(point15,point14);
    paint.drawLine(point14,point12);
    paint.drawLine(point15,point16);
    paint.drawLine(point16,point10);
    paint.drawLine(point10,point17);
    paint.drawLine(point17,point18);
    paint.drawLine(point18,point19);
    paint.drawLine(point18,point8);
    paint.drawLine(point19,point8);
    paint.drawLine(point19,point5);
    paint.drawLine(point5,point20);
    paint.drawLine(point19,point20);
    paint.drawLine(point20,point21);
    paint.drawLine(point21,point5);
    paint.drawLine(point21,point22);
    paint.drawLine(point22,point23);
    paint.drawLine(point23,point3);
    paint.drawLine(point23,point2);
    paint.drawLine(point22,point2); //419- 379 = 40

}

void Widget::ppt()
{
    //画动态图
    static double dex=0;
    static double dex2=0;
    ende:
    double x1,y1;
    double x2,y2;
    x1=p1.x();
    y1=p1.y();
    x2=p2.x();
    y2=p2.y();
    //分为四类s
    //1.x1>x2 && y1>y2
    if(x1<x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1+i*t;
        double yy=k*xx+b;
        pointc.setX(xx);
        pointc.setY(yy);
        if(xx>x2){
            count2++;
            if(count2+2<=num)
            {
                p1=points[e[count2]-1];
                p2=points[e[count2+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
            }
            else{
                timer->stop();
                ui->labels1->setText("医院已经到达!");
                ui->lentime_yiyuan->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(255,0,0);
        QPen pen(red);
        pen.setWidth(5);
        paint.setPen(pen);
        paint.drawLine(p1,pointc);
        update();
        i++;
    }
    else if(x1>=x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1-i*t;
        double yy=k*xx+b;
        pointc.setX(xx);
        pointc.setY(yy);
        if(xx<x2){
            count2++;
            if(count2+2<=num)
            {
                p1=points[e[count2]-1];
                p2=points[e[count2+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
             }
            else{
                timer->stop();
                ui->labels1->setText("医院已经到达!");
                ui->lentime_yiyuan->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(255,0,0);
        QPen pen(red);
        pen.setWidth(5);
        paint.setPen(pen);
        paint.drawLine(p1,pointc);
        update();
        i++;
    }
    double xe,ye;
    double xee,yee;
    xe=p1.x();
    ye=p1.y();
    xee=pointc.x();
    yee=pointc.y();
    dex=sqrt((xe-xee)*(xe-xee)+(ye-yee)*(ye-yee));
    int min=9999;
    int j=0;
    for(int i=1;i<=n;i++){
        if(map.dis[i]<min&&map.buite[i]==3){
           j=i;
           min=map.dis[i];
        }
    }
    double e=map.dis[j];
    if(e-dex2-dex<=0||e-dex2-dex<=70)
    {
        ui->lentime_yiyuan->setText(QString::number(0,10,3));
    }
    else
    {
        ui->lentime_yiyuan->setText(QString::number(e-dex2-dex,10,3));
    }
    update();
}

void Widget::plt()
{
    timer=new QTimer(this);
    connect(timer,SIGNAL(timeout()),this,SLOT(ppt()));
    p1=points[e[count2]-1];
    p2=points[e[count2+1]-1];
    timer->start(50);  //计时器开始
}

void Widget::plt2(){
    timer2=new QTimer(this);
    connect(timer2,SIGNAL(timeout()),this,SLOT(ppt2()));
    p3=points[e2[count22]-1];
    p4=points[e2[count22+1]-1];
    timer2->start(50);  //计时器开始
}

void Widget::ppt2()
{
    //画动态图
    static double dex=0;
    static double dex2=0;
    ende:
    double x1,y1;
    double x2,y2;
    x1=p3.x();
    y1=p3.y();
    x2=p4.x();
    y2=p4.y();
    //分为四类s
    //1.x1>x2 && y1>y2
    if(x1<x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1+i*t;
        double yy=k*xx+b;
        pointc2.setX(xx);
        pointc2.setY(yy);
        if(xx>x2){
            count22++;
            if(count22+2<=num2)
            {
                p3=points[e2[count22]-1];
                p4=points[e2[count22+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
            }
            else{
                timer2->stop();
                ui->labels2->setText("公安局已经到达!");
                ui->lentime_gonganju->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(0,191,255);
        QPen pen(red);
        pen.setWidth(6);
        paint.setPen(pen);
        paint.drawLine(p3,pointc2);
        update();
        i++;
    }
    else if(x1>=x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1-i*t;
        double yy=k*xx+b;
        pointc2.setX(xx);
        pointc2.setY(yy);
        if(xx<x2){
            count22++;
            if(count22+2<=num2)
            {
                p3=points[e2[count22]-1];
                p4=points[e2[count22+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
             }
            else{
                timer2->stop();
                ui->labels2->setText("公安局已经到达!");
                ui->lentime_gonganju->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(0,191,255);
        QPen pen(red);
        pen.setWidth(6);
        paint.setPen(pen);
        paint.drawLine(p3,pointc2);
        update();
        i++;
    }
    double xe,ye;
    double xee,yee;
    xe=p3.x();
    ye=p3.y();
    xee=pointc2.x();
    yee=pointc2.y();
    dex=sqrt((xe-xee)*(xe-xee)+(ye-yee)*(ye-yee));
    int min2=9999;
    int j2=0;
    for(int i=1;i<=n;i++){
        if(map.dis[i]<min2&&map.buite[i]==1){
           j2=i;
           min2=map.dis[i];
        }
    }
    double e=map.dis[j2];
    if(e-dex2-dex<=0||e-dex2-dex<=70)
    {
        ui->lentime_gonganju->setText(QString::number(0,10,3));
    }
    else
    {
        ui->lentime_gonganju->setText(QString::number(e-dex2-dex,10,3));
    }
    update();
}

void Widget::plt3(){
    timer3=new QTimer(this);
    connect(timer3,SIGNAL(timeout()),this,SLOT(ppt3()));
    p5=points[e3[count3]-1];
    p6=points[e3[count3+1]-1];
    timer3->start(50);  //计时器开始
}

void Widget::ppt3()
{
    //画动态图
    static double dex=0;
    static double dex2=0;
    ende:
    double x1,y1;
    double x2,y2;
    x1=p5.x();
    y1=p5.y();
    x2=p6.x();
    y2=p6.y();
    //分为四类s
    //1.x1>x2 && y1>y2
    if(x1<x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1+i*t;
        double yy=k*xx+b;
        pointc3.setX(xx);
        pointc3.setY(yy);
        if(xx>x2){
            count3++;
            if(count3+2<=num3)
            {
                p5=points[e3[count3]-1];
                p6=points[e3[count3+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
            }
            else{
                update();
                timer3->stop();
                ui->labels3->setText("维修点已经到达!");
                ui->lentime_weixiu->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(127,255,0);
        QPen pen(red);
        pen.setWidth(7);
        paint.setPen(pen);
        paint.drawLine(p5,pointc3);
        update();
        i++;
    }
    else if(x1>=x2){
        double k=(y2-y1)/(x2-x1);
        double b=y2-k*x2;
        double t=fabs((x2-x1)/50.0);
        static int i=1;
        double xx=x1-i*t;
        double yy=k*xx+b;
        pointc3.setX(xx);
        pointc3.setY(yy);
        if(xx<x2){
            count3++;
            if(count3+2<=num3)
            {
                p5=points[e3[count3]-1];
                p6=points[e3[count3+1]-1];
                i=1;
                dex2+=dex;
                goto ende;
             }
            else{
                update();
                timer3->stop();
                ui->labels3->setText("维修点已经到达!");
                ui->lentime_weixiu->setText(QString::number(0,10,3));
                update();
            }
        }
        QPainter paint(&Pix);
        QColor red(127,255,0);
        QPen pen(red);
        pen.setWidth(7);
        paint.setPen(pen);
        paint.drawLine(p5,pointc3);
        update();
        i++;
    }
    double xe,ye;
    double xee,yee;
    xe=p5.x();
    ye=p5.y();
    xee=pointc3.x();
    yee=pointc3.y();
    dex=sqrt((xe-xee)*(xe-xee)+(ye-yee)*(ye-yee));
    int min3=9999;
    int j3=0;
    for(int i=1;i<=n;i++){
        if(map.dis[i]<min3&&map.buite[i]==2){
           j3=i;
           min3=map.dis[i];
        }
    }
    double e=map.dis[j3];
    if(e-dex2-dex<=0||e-dex2-dex<=70)
    {
        ui->lentime_weixiu->setText(QString::number(0,10,3));
    }
    else
    {
        ui->lentime_weixiu->setText(QString::number(e-dex2-dex,10,3));
    }
    update();
}

void Widget::plt_line(int v0){
    int v1;
    int min=9999;
    int j=0;
    for(int i=1;i<=n;i++){
        if(map.dis[i]<min&&map.buite[i]==3){
           j=i;
           min=map.dis[i];
        }
    }
    v1=j;
    int path2[1000]={0};
    for(int i=1;i<n+1;i++){
        if(i==v1){
            int k = 1;
            path2[k] = i;
            while (path[path2[k]] != -1) {
                k++;
                path2[k] = path[path2[k - 1]];
            }
            k++;
            path2[k] = v0;
            for(int j=k-1;j>0;j--){
                e[k-j]=path2[j];
            }
                num=k;
                break;
            }
        }
    plt();
    update();


   //第2条路径是找公安局
   int v2=12;
   int min2=9999;
   int j2=0;
   for(int i=1;i<=n;i++){
       if(map.dis[i]<min2&&map.buite[i]==1){
          j2=i;
          min2=map.dis[i];
       }
   }
   v2=j2;
   memset(e2,0,sizeof(e2));
   memset(path2,0,sizeof(path2));
   num2=0;
   for(int i=1;i<n+1;i++){
       if(i==v2){
           int k = 1;
           path2[k] = i;
           while (path[path2[k]] != -1) {
               k++;
               path2[k] = path[path2[k - 1]];
           }
           k++;
           path2[k] = v0;
           for(int j=k-1;j>0;j--){
               e2[k-j]=path2[j];
           }
           num2=k;
           break;
       }
   }
   plt2();
   update();

   //第三条路径是找修理店
   int v3=23;
   int min3=9999;
   int j3=0;
   for(int i=1;i<=n;i++){
       if(map.dis[i]<min3&&map.buite[i]==2){
          j3=i;
          min3=map.dis[i];
       }
   }
   v3=j3;
   memset(e3,0,sizeof(e3));
   memset(path2,0,sizeof(path2));
   num3=0;
   for(int i=1;i<n+1;i++){
       if(i==v3){
           int k = 1;
           path2[k] = i;
           while (path[path2[k]] != -1) {
               k++;
               path2[k] = path[path2[k - 1]];
           }
           k++;
           path2[k] = v0;
           for(int j=k-1;j>0;j--){
               e3[k-j]=path2[j];
           }
           num3=k;
           break;
       }
   }
   plt3();
   update();
}

void Widget::on_m_pb1_clicked(){
    ui->m_pb1->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置1");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));

    //第一条路径找医院
    int v0=1;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb3_clicked()
{
    ui->m_pb3->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置3");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");

    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=3;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb2_clicked()
{
    ui->m_pb2->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                    "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                    "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置2");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=2;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb5_clicked()
{
    ui->m_pb5->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置5");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=5;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb4_clicked()
{
    ui->m_pb4->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置4");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=4;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb9_clicked()
{
    ui->m_pb9->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置9");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=9;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb7_clicked()
{
    ui->m_pb7->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置7");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=7;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb6_clicked()
{
    ui->m_pb6->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    //第一条路径找医院
    ui->labels1->setText("事故发生在位置6");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    int v0=6;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb8_clicked()
{
    ui->m_pb8->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置8");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=8;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb10_clicked()
{
    ui->m_pb10->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置10");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=10;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_pushButton_clicked()
{

}

void Widget::on_m_pb11_clicked()
{
    ui->m_pb11->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置11");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=11;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb12_clicked()
{
    ui->m_pb12->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置12");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=12;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb13_clicked()
{
    ui->m_pb13->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置13");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=13;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb14_clicked()
{
    ui->m_pb14->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置14");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");

    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=14;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb15_clicked()
{
    ui->m_pb15->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置15");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=15;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb16_clicked()
{
    ui->m_pb16->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置16");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");

    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=16;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb17_clicked()
{
    ui->m_pb17->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置17");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=17;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb18_clicked()
{
    ui->m_pb18->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置18");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=18;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb19_clicked()
{
    ui->m_pb19->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置19");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=19;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb20_clicked()
{
    ui->m_pb20->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置20");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=20;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb21_clicked()
{
    ui->m_pb21->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置21");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;
    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=21;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb22_clicked()
{
    ui->m_pb22->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置22");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=22;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}

void Widget::on_m_pb23_clicked()
{
    ui->m_pb23->setStyleSheet("QPushButton{background-color: rgb(139, 0, 139);border-style:outset;border-width:4px;border-radius:10px;color:rgb(255, 255, 255);}"
                             "QPushButton:hover{background-color: rgb(20, 62, 190);}"
                             "QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}");
    ui->labels1->setText("事故发生在位置23");
    ui->labels2->setText("正在上报情况...");
    ui->labels3->setText("...............");
    count2=1;
    count22=1;
    count3=1;

    memset(e,0,sizeof(e));
    memset(e2,0,sizeof(e2));
    memset(e3,0,sizeof(e3));
    //第一条路径找医院
    int v0=23;  //2
    int v1=19;  //1
    num=0;
    map.Dijkstra(v0);
    plt_line(v0);
}
